package com.weixing.mall.provider.controller.front;

import com.weixing.mall.base.wrapper.Result;
import com.weixing.mall.base.wrapper.ResultUtil;
import com.weixing.mall.core.annotation.NoRepeatSubmit;
import com.weixing.mall.provider.model.dto.OrderOperationDto;
import com.weixing.mall.provider.model.vo.OrderOperationVo;
import com.weixing.mall.provider.service.IOrderOperationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @ClassName orderOperationController
 * @Description TODO <br/>
 * @Author gjq
 * @Modified By:
 * @Date 2019/9/30
 * @Version 1.0
 **/
@RestController
@RequestMapping("front/orderOperation")
@Api(value = "前端：订单操作APi", tags = "前端：订单操作")
public class FrontOrderOperationController {


    @Autowired
    private IOrderOperationService orderOperationService;


    @ApiOperation(value = "加载订单操作列表")
    @GetMapping("getOrderOperation/{orderId}")
    public Result getOrderList(@PathVariable Long orderId) {
        List<OrderOperationVo> list = orderOperationService.selectList(orderId);
        return ResultUtil.success(list);
    }

    @ApiOperation(value = "保存订单操作")
    @PostMapping("save")
    @NoRepeatSubmit
    public Result save(@RequestBody OrderOperationDto orderOperationDto) {
        orderOperationService.save(orderOperationDto);
        return ResultUtil.success();
    }
}
